﻿@model Zor_Web.Models.Home.V_Main
@using Zor_Tools;
@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <title>综合治税GIS</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <script src="~/Content/Scripts/Index.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>

    @*<link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />*@
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
</head>

<body >
    <!-- 布局容器 -->
    <div class="layui-layout layui-layout-admin">
        <!-- 头部 -->
        <div class="layui-header header">
            <div class="layui-main">
                <!-- logo -->
                <img src="~/Content/Images/logo.png" width="400" height="65" />
                @*<a href="/" style="color: #fff; font-size: 22px; font-family: cursive; line-height: 60px; ">综合治税GIS管理平台</a>*@
                
                <ul id="top_menu" class="layui-nav" style="position: absolute; top: 0; left: 400px; background: none;">
                    @foreach (var item in Model.Menu)
                    {
                        <li class="layui-nav-item" onclick="Menuclick(@item.Nav_Id)"><a href="#">@item.Nav_Title</a></li>
                    }
                </ul>
                <!-- 水平导航 -->
                <ul class="layui-nav" style="position: absolute; top: 0; right: 0; background: none;">

                    <li class="layui-nav-item" >
                        <div id="sp_Time"></div>
                        <a href="javascript:;"> @RequestSession.GetSessionUser().User_RealName</a>
                        <dl class="layui-nav-child">
                            <dd>
                                <a href="javascript:;">个人信息</a>
                            </dd>
                            <dd>
                                <a href="javascript:;" onclick="changeUserPasswWord();">修改密码</a>
                            </dd>
                            <dd>
                                <a href="javascript:;" onclick="IndexOut();">退出登录</a>
                            </dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
        <!-- 侧边栏 -->
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll" id="left">
                <ul class="layui-nav layui-nav-tree" lay-filter="left-nav" style="border-radius: 0;"></ul>              
            </div>
        </div>
        <!-- 主体 -->
        <div class="layui-body">
            <!-- 顶部切换卡 -->
            <div class="layui-tab layui-tab-brief" lay-filter="top-tab" lay-allowclose="true" style="margin: 0;">
                <ul class="layui-tab-title"></ul>
                <div class="layui-tab-content layui-bg-gray"></div>
            </div>
        </div>
    </div>
    <!--修改密码模态-->
    <div id="ModalchangeUserPasswWord" hidden data-backdrop="static">    
        <div style="height:20px"></div>   
        <form class="layui-form" action="">
            <div class="layui-form-item" style="text-align:left">
                <div class="layui-inline">
                    <label class="layui-form-label">用户旧密码：</label>
                    <div class="layui-input-inline">
                        <input id="oldPassword" type="password" class="layui-input"  placeholder="请输入当前密码" style="width:300px">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">用户新密码：</label>
                    <div class="layui-input-inline">
                        <input id="newFirstPassword" type="password" autocomplete="off" class="layui-input" placeholder="请输入新密码" style="width:300px">
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label">确认新密码：</label>
                    <div class="layui-input-inline">
                        <input id="newSecondPassword" type="password" class="layui-input" placeholder="请再次输入新密码" style="width:300px">
                    </div>
                </div>
            </div>
        </form>
            <div class="box-footer" style="text-align:right">
                <button id="btnRentSure" class="layui-btn layui-btn-normal">确定</button>               
            </div>
</div>  

    <script src="~/Content/LayerUI/src/layui.js"></script>
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>

    <script type="text/javascript">
    /*** 对layui进行全局配置*/
    layui.config({
        base: '../../Content/LayerUI/build/js/'
    });

    function Menuclick(fatherId) {
       
        var cms = layui.cms('left-nav', 'top-tab');
        var ary = new Array();
        ary.push({ id: 1, pid: fatherId, node: '主页', url: 'MainPage' });
        getAjax("/Home/NodeMenu", { "fatherId": fatherId }, function (data) {
            var accordionMenu = eval("(" + data + ")");
            $.each(accordionMenu, function (i) {
              
                ary.push({ id: accordionMenu[i].Nav_Id, pid: accordionMenu[i].Nav_ParentID, node: accordionMenu[i].Nav_Title, url: accordionMenu[i].Nav_Linkurl });
            });
          
        })        
        cms.addNav(ary, fatherId, 'id', 'pid', 'node', 'url');
        cms.bind(60 + 41 + 20 + 0); //头部高度 + 顶部切换卡标题高度 + 顶部切换卡内容padding + 底部高度
        cms.clickLI(0);
    }

    /*** 初始化整个cms骨架*/
    layui.use(['cms'], function () {
        var cms = layui.cms('left-nav', 'top-tab');
        cms.addNav([
                { id: 1, pid: 0, node: '主页', url: '/Stat/AnnualTaskMap' },
        ], 0, 'id', 'pid', 'node', 'url');

        cms.bind(60 + 41 + 20 + 0); //头部高度 + 顶部切换卡标题高度 + 顶部切换卡内容padding + 底部高度
        cms.clickLI(0);
        Menuonload();
    });

    function Menuonload()
    {        
        $("#top_menu li:first").click();
    }
    
    
    //修改用户密码
    function changeUserPasswWord() {
        LayerOpen('500px', '280px', '修改密码', $('#ModalchangeUserPasswWord'));
    }
    //确认修改密码
    $(function () {
        $("#btnRentSure").click(function () {
            //获取当前输入的旧密码
            var oldPassword = $("#oldPassword").val();
            //获取第一次输入新密码
            var newFirstPassword = $("#newFirstPassword").val();
            //获取第二次输入新密码
            var newSecondPassword = $("#newSecondPassword").val();

            if (oldPassword == "")
            {
                layer.msg("旧密码输入不能为空！", 0);
                return;
            }
            //对比输入的两次新密码是否匹配
            ZorPostSimpleData("/Home/IsOldPassMapping", JSON.stringify({ "oldPass": oldPassword }), function (data) {
                      
                if (data.AnswerMeg == "") {
                    if (newFirstPassword == oldPassword) {
                        layer.msg("新密码输入不能和旧密码一致！", 0);
                        return;
                    }
                    if (newFirstPassword == "") {
                        layer.msg("新密码输入不能为空！", 0);
                        return;
                    }
                    if (newSecondPassword == "") {
                        layer.msg("确认密码输入不能为空！", 0);
                        return;
                    }
                    //对比旧密码是否匹配
                    if (newFirstPassword != newSecondPassword) {
                        layer.msg("两次输入的密码不一致，请重新输入！", 0);
                        return;
                    }
                    //修改密码
                    ZorPostSimpleData("/Home/UpdatePass", JSON.stringify({ "newPass": newFirstPassword }), function (data) {
                        layer.msg(data.AnswerMeg, function () {
                            //if (data.AnswerMeg ==  "密码修改成功！")
                            //{
                            //    window.location.href = "javascript:history.go(-1)";                              
                            //}
                            layer.closeAll();
                            Replace();
                        });
                    });
                }
                else {
                    layer.msg(data.AnswerMeg);
                } 
            });                  
        })
    })
    </script>
</body>
</html>